__author__ = 'st316'
'''
Implement pow(x, n).
'''


class Solution:
    # @param x, a float
    # @param n, a integer
    # @return a float
    def pow(self, x, n):
        if x == 0:
            return 0.0
        if n == 0:
            return 1.0
        if n == 1:
            return x
        if n < 0:
            n = -n
            if not n & 1:
                t = self.pow(x, n / 2)
                return 1 / float(t * t)
            else:
                t = self.pow(x, (n - 1) / 2)
                return 1 / float(t * t * x)
        else:
            if not n & 1:
                t = self.pow(x, n / 2)
                return float(t * t)
            else:
                t = self.pow(x, (n - 1) / 2)
                return float(t * t * x)


if __name__ == '__main__':
    s = Solution()
    print s.pow(34.00515, -3)

